package com.cn.xiaonuo.tcrfinance.xmpay.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.tcrfinance.tcrorder.param.ReflectRecordParam;
import com.cn.xiaonuo.tcrfinance.tcrshops.param.PlatformParam;
import com.cn.xiaonuo.tcrfinance.xmpay.param.BranchFundInquiryParam;
import com.cn.xiaonuo.tcrfinance.xmpay.param.MemberParam;
import com.cn.xiaonuo.tcrfinance.xmpay.service.MemberService;
import com.cn.xiaonuo.tcrfinance.xmpay.vo.CheckFileDownloadReqVo;
import com.cn.xiaonuo.tcrfinance.xmpay.vo.MemberWithdrawReqVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@RestController
public class XmMemberController {

    @Autowired
    private MemberService memberService;

    /**
     * 认证会员列表
     */
    @ApiOperation(value = "认证会员列表", notes = "认证会员列表")
    @PostMapping("/api/member/page")
    public BusinessMessage queryShopList(@RequestBody MemberParam memberParam) {
        BusinessMessage message = memberService.queryShopList(memberParam);
        return message;
    }

    /**
     提现记录
     */
    @ApiOperation(value = "提现记录", notes = "提现记录")
    @PostMapping("/api/xm/platform/selcetOutGoldemDeatail")
    public BusinessMessage selcetOutGoldemDeatail(@RequestBody ReflectRecordParam reflectRecordParam) {
        BusinessMessage message = memberService.selcetOutGoldemDeatail(reflectRecordParam);
        return message;
    }

    @ApiOperation(value = "提现申请", notes = "提现申请")
    @PostMapping("/api/xm/platform/selectRemitDetail")
    public BusinessMessage selectRemitDetail(@RequestBody ReflectRecordParam reflectRecordParam) {
        BusinessMessage message = memberService.selectRemitDetail(reflectRecordParam);
        return message;
    }

    /**
     * 订单详情
     */
    @ApiOperation(value = "充值记录", notes = "充值记录")
    @PostMapping("/api/xm/platform/selcetInGoldemDeatail")
    public BusinessMessage selcetInGoldemDeatail(@RequestBody PlatformParam params) {
        BusinessMessage message = memberService.selcetInGoldemDeatail(params);
        return message;
    }

    @ApiOperation("会员资金查询")
    @PostMapping(value = "/api/common/xm/memberBranchFundInquiry")
    public BusinessMessage memberBranchFundInquiry(@RequestBody BranchFundInquiryParam param) {
        return memberService.memberBranchFundInquiry(param);
    }

    @ApiOperation("平台资金查询")
    @PostMapping(value = "/api/common/xm/platformBranchFundInquiry")
    public BusinessMessage platformBranchFundInquiry() {
        return memberService.platformBranchFundInquiry();
    }

    @ApiOperation("平台资金查询")
    @PostMapping(value = "/api/common/xm/checkCommonFileDownload")
    public void checkCommonFileDownload(@RequestBody CheckFileDownloadReqVo reqVo, HttpServletResponse response) {
        memberService.checkCommonFileDownload(reqVo,response);
    }


    @ApiOperation(value = "", notes = "提现页面短信发送")
    @PostMapping(value = "/api/common/appWallet/cw/sendVerificationCode")
    public BusinessMessage cwSendVerificationCode(@RequestBody List<Integer> orderIds){
        return memberService.cwSendVerificationCode(orderIds);
    }


    /**
     * @title 打款/结款操作
     * @description 结款操作
     */
    @ApiOperation(value = "打款/结款操作", notes = "打款/结款操作")
    @PostMapping("/api/xm/platform/updateRemitStatus")
    public BusinessMessage updateRemitStatus(@RequestBody Map<String, Object> params) {
        BusinessMessage message = memberService.updateRemitStatus(params);
        return message;
    }

    /**
     * @title 15.批量结款操作
     * @description 批量结款操作
     */
    @PostMapping("/api/xm/platform/updateBatchRemitStatus")
    public BusinessMessage updateBatchRemitStatus(@RequestBody Map<String, Object> params) {
        BusinessMessage message = memberService.updateBatchRemitStatus(params);
        return message;
    }

    /**
     * 查看厦门银行打款失败原因
     * @param
     * @return
     */
    @ApiOperation(value = "查看厦门银行打款失败原因", notes = "查看厦门银行打款失败原因")
    @PostMapping("/api/xm/platform/see")
    public BusinessMessage see(Integer orderId) {
        BusinessMessage message = memberService.see(orderId);
        return message;
    }

    /**
     * 提现信息获取
     * @param reqVo
     * @return
     */
    @PostMapping("/api/xm/platform/getMemberWithdraw")
    public BusinessMessage getMemberWithdraw(@RequestBody MemberWithdrawReqVo reqVo) {
        BusinessMessage message = memberService.getMemberWithdraw(reqVo);
        return message;
    }


    /**
     * 会员提现
     * @param reqVo
     * @return
     */
    @PostMapping("/api/xm/platform/memberWithdraw")
    public BusinessMessage memberWithdraw(@RequestBody MemberWithdrawReqVo reqVo) {
        BusinessMessage message = memberService.memberWithdraw(reqVo);
        return message;
    }

    @PostMapping("/api/xm/platform/memberWithdraw/againRemit")
    public BusinessMessage memberWithdrawAgainRemit(Integer orderId) {
        BusinessMessage message = memberService.memberWithdrawAgainRemit(orderId);
        return message;
    }



}
